AddProject = {
	saveConfig:function (){
		var projectName = document.getElementById("projectName").value;
		var desc = document.getElementById("desc").value;
		var projectNameList = document.getElementsByName("projectNameList");
		var manager = document.getElementById("manager").value;
		var process = document.getElementById("process").value;
		var clientName = document.getElementById("clientName").value;
		var clientAddress = document.getElementById("clientAddress").value;
		
		//获取复选框中的value
		var member = document.getElementsByName('member');   
		var members='';    
		for(var i=0; i<member.length; i++){    
			if(member[i].checked){
				members+=member[i].value+',';
			}
		}
		for(var i=0;i<projectNameList.length;i++){
		    var k = projectNameList[i].value;
		    if(projectName==k){
		        PigossMsg.alert("同名的项目名已经存在！");
		        return;
		    }
		}
		
		if(projectName==0||projectName==''){
		   PigossMsg.alert("项目名称不能为空或者空格！");
		   return;
		   document.getElementById("projectName").focus();
		}
		//对勾选的人进行判断，用','分隔，最少勾两个人，逗号最少有三个
		var membersLength = members.split(",");
		if(membersLength.length < 3){
		   PigossMsg.alert("项目组成员最少有两人！");
		   return;
		}
		if(clientName==0||clientName==''){
		   PigossMsg.alert("客户名称不能为空或者空格！");
		   return;
		}
		if(desc==0||desc==''){
		   PigossMsg.alert("项目描述不能为空或者空格！");
		   return;
		}
		AjaxUtil.request({
			url : 'add_project.action',
			params : {projectName:projectName,members:members,manager:manager,process:process,clientName:clientName,clientAddress:clientAddress,desc:desc},
			success : function(responseText){
				RefreshPro.refresh();
			},
			failure : function(){
				PigossMsg.alert("添加失败!");
			}
		});
		imgCloseShow();
	    
	}
};

RefreshhProject= {
   refresh:function(){
       document.getElementById("queryProjectServiceByCondition").submit();
   }
};

RefreshPro= {
   refresh:function(){
       document.getElementById("queryProjectByCondition").submit();
   }
};
EditProject= {
    editConfig:function (){
    	var pid = document.getElementById("pid").value;
    	var projectName = document.getElementById("editProjectName").value;
		var desc = document.getElementById("editDesc").value;
		var projectNameList = document.getElementsByName("projectNameList");
		var manager = document.getElementById("editManager").value;
		var process = document.getElementById("editProcess").value;
		var clientName = document.getElementById("editClientName").value;
		var clientAddress = document.getElementById("editClientAddress").value;
		
		var member=document.getElementsByName('editMember');
		var members='';    
		for(var i=0; i<member.length; i++){    
			if(member[i].checked){
				members+=member[i].value+',';
			}
		}
		/*for(var i=0;i<projectNameList.length;i++){
		    var k = projectNameList[i].value;
		    if(projectName==k){
		        PigossMsg.alert("同名的项目名已经存在！");
		        return;
		    }
		}*/
		
		if(name==0||name==''){
		   PigossMsg.alert("项目名称不能为空或者空格！");
		   return;
		}
		/*if(username =='admin'){
		   createrProject = document.getElementById("createrProject").value;
		}*/
		AjaxUtil.request({
			url : 'editAndUpdateProject.action',
			params : {pid:pid,projectName:projectName,desc:desc,manager:manager,process:process,members:members,clientName:clientName,clientAddress:clientAddress},
			success : function(responseText){
				//window.location.reload();
				RefreshPro.refresh();
			},
			failure : function(){
				 PigossMsg.alert("修改失败!");
			}
		});
		imgCloseShow();	
	},
	
	del:function (id){
	    AjaxUtil.request({
			url : 'deleteProject.action',
			params : {id:id},
			success : function(responseText){
				//window.location.reload();
				RefreshPro.refresh();
			},
			failure : function(){
				PigossMsg.alert("删除失败!");
			}
		});
	}
};

	

	
	
//对项目下的服务记录表保存的操作
AddProjectSale = {
		saveSale:function (){
			
			var id = document.getElementById("pid").value;
			
			var supportDate = document.getElementById("supportDate").value;
			var hours = document.getElementById("hours").value;
			var address = document.getElementById("address").value;
			var otherPeople = document.getElementById("otherPeople").value;
			var serviceType = document.getElementById("serviceType").value;
			var serviceNo = document.getElementById("selectServiceType").value;
			
			//勾选添加工时和联系人操作
			var intoClientContact = document.getElementById("intoClientContact");
			var intoLabor = document.getElementById("intoLabor");
			var insertClientContact = "";
			var insertLabor = "";
			
			if(intoClientContact.checked){
				insertClientContact += intoClientContact.value;
			};
			if(intoLabor.checked){
				insertLabor += intoLabor.value;
			};
			//分割ourPeople的操作
			var ourPeople = document.getElementsByName("ourPeople");
			var ourPeoples='';    
			for(var i=0; i<ourPeople.length; i++){    
				if(ourPeople[i].checked){
					ourPeoples+=ourPeople[i].value+',';
				}
			}    
			
			//对关联产品的操作
			var showProductMsgInput = document.getElementById("showProductMsgInput");
			//勾选显示产品信息才对产品表进行修改操作
			if(showProductMsgInput.checked){
				var noProduct = document.getElementById("noProduct").value;
				//勾选了但没有产品，就不做处理
				if(noProduct == ""){
					//不做处理
				} else {
					//勾选了有产品，才做处理
					var PSproductId = document.getElementById("PSproductId").value;
					var PSproduct = document.getElementById("PSproduct").value;
					var PSproductIp = document.getElementById("PSproductIp").value;
					var PSproductDNS = document.getElementById("PSproductDNS").value;
					var PSproductGetway = document.getElementById("PSproductGetway").value;
					
					if(PSproduct == '' || PSproduct == 0){
						PigossMsg.alert("产品型号不能为空或者空格！");
						return;
					}
					if(PSproductIp == '' || PSproductIp == 0){
						PigossMsg.alert("产品IP不能为空或者空格！");
						return;
					}
					if(PSproductDNS == '' || PSproductDNS == 0){
						PigossMsg.alert("DNS不能为空或者空格！");
						return;
					}
					if(PSproductGetway == '' || PSproductGetway == 0){
						PigossMsg.alert("网关不能为空或者空格！");
						return;
					}
					AjaxUtil.request({
						url : 'update_ps_product.action',
						params : {id:PSproductId,product:PSproduct,ip:PSproductIp,dns:PSproductDNS,gateway:PSproductGetway},
						success : function(responseText){
							//window.location.reload();
						},
						failure : function(){
							PigossMsg.alert("删除失败!");
						}
					});
				}
			}
			
			var i1 = "";
			var i2 = "";
			var i3 = "";
			var i4 = "";
			var i5 = "";
			var i6 = "";
			var i7 = "";
			var i8 = "";
			var i9 = "";
			var i10 = "";
			var i11 = "";
			var i12 = "";
			var i13 = "";
			var i14 = "";
			var i15 = "";
			
			if(hours == '' || hours == 0){
				PigossMsg.alert("小时数不能为空或者空格！");
				return;
			}
			if(otherPeople == '' || otherPeople == 0){
				PigossMsg.alert("他方人员不能为空或者空格！");
				return;
			}
			
			//服务类型的非空验证
			if(serviceNo == ""){
				PigossMsg.alert("服务记录类型必选！");
				return;
			};
			
			//验证现场售后服务
			if(serviceNo=="s1"){
				 i1 = document.getElementById("i1").value;
				 i2 = document.getElementById("i2").value;
				 i3 = document.getElementById("i3").value;
				 i4 = document.getElementById("i4").value;
				 i6 = document.getElementById("i6").value;
				 i7 = document.getElementById("i7").value;
				 i8 = document.getElementById("i8").value;
				 //i13 = document.getElementById("i13").value;
				 
				  if(i1 == '' || i1 == 0){
					  PigossMsg.alert("预期目标不能为空或者空格！");
					  return;
				  }
				  
				  if(i2 == '' || i2 == 0){
					  PigossMsg.alert("工作内容记录不能为空或者空格！");
					  return;
				  }
				  if(i3 == '' || i3 == 0){
					  PigossMsg.alert("客户关注点不能为空或者空格！");
					  return;
				  }
				  if(i4 == '' || i4 == 0){
					  PigossMsg.alert("下一步计划不能为空或者空格！");
					  return;
				  }
				  if(i6 == '' || i6 == 0){
					  PigossMsg.alert("遗留问题不能为空或者空格！");
					  return;
				  }
				  	 
			}
			//对现场实施服务验证
			if(serviceNo=="s2"){
				 i1 = document.getElementById("i1").value;
				 i2 = document.getElementById("i2").value;
				 i3 = document.getElementById("i3").value;
				 i4 = document.getElementById("i4").value;
				 i6 = document.getElementById("i6").value;
				 i7 = document.getElementById("i7").value;
				 i8 = document.getElementById("i8").value;
				 //i13 = document.getElementById("i13").value;
				  if(i1 == '' || i1 == 0){
					  PigossMsg.alert("预期目标不能为空或者空格！");
					  return;
				  }
				  
				  if(i2 == '' || i2 == 0){
					  PigossMsg.alert("工作内容记录不能为空或者空格！");
					  return;
				  }
				  if(i3 == '' || i3 == 0){
					  PigossMsg.alert("客户关注点不能为空或者空格！");
					  return;
				  }
				  if(i4 == '' || i4 == 0){
					  PigossMsg.alert("下一步计划不能为空或者空格！");
					  return;
				  }
				  if(i6 == '' || i6 == 0){
					  PigossMsg.alert("遗留问题不能为空或者空格！");
					  return;
				  }
				  	 
			}
			//对现场售前测试(POC)进行验证
			if(serviceNo=="s3"){
				 i1 = document.getElementById("i1").value;
				 i2 = document.getElementById("i2").value;
				 i3 = document.getElementById("i3").value;
				 i4 = document.getElementById("i4").value;
				 i6 = document.getElementById("i6").value;
				 i7 = document.getElementById("i7").value;
				 i8 = document.getElementById("i8").value;
				 i9 = document.getElementById("i9").value;
				 i11 = document.getElementById("i11").value;
				 //i13 = document.getElementById("i13").value;
				 i15 = document.getElementById("i15").value;
				  if(i1 == '' || i1 == 0){
					  PigossMsg.alert("预期目标不能为空或者空格！");
					  return;
				  }
				  if(i2 == '' || i2 == 0){
					  PigossMsg.alert("工作内容记录不能为空或者空格！");
					  return;
				  }
				  if(i3 == '' || i3 == 0){
					  PigossMsg.alert("客户关注点不能为空或者空格！");
					  return;
				  }
				  if(i4 == '' || i4 == 0){
					  PigossMsg.alert("下一步计划不能为空或者空格！");
					  return;
				  }
				  if(i6 == '' || i6 == 0){
					  PigossMsg.alert("遗留问题不能为空或者空格！");
					  return;
				  }
				  	 
			}
			//对系统升级服务
			/*if(serviceNo=="s4"){
				 i1 = document.getElementById("i1").value;
				 i2 = document.getElementById("i2").value;
				 i3 = document.getElementById("i3").value;
				 i4 = document.getElementById("i4").value;
				 i6 = document.getElementById("i6").value;
				 i7 = document.getElementById("i7").value;
				 i8 = document.getElementById("i8").value;
				 i12 = document.getElementById("i12").value;
				 i13 = document.getElementById("i13").value;
				  if(i1 == '' || i1 == 0){
					  PigossMsg.alert("预期目标不能为空或者空格！");
					  return;
				  }
				  if(i2 == '' || i2 == 0){
					  PigossMsg.alert("工作内容记录不能为空或者空格！");
					  return;
				  }
				  if(i3 == '' || i3 == 0){
					  PigossMsg.alert("客户关注点不能为空或者空格！");
					  return;
				  }
				  if(i4 == '' || i4 == 0){
					  PigossMsg.alert("下一步计划不能为空或者空格！");
					  return;
				  }
				  if(i6 == '' || i6 == 0){
					  PigossMsg.alert("遗留问题不能为空或者空格！");
					  return;
				  }
				  	 
			}*/
			//对售前交流验证
			if(serviceNo=="s5"){
				 i1 = document.getElementById("i1").value;
				 i3 = document.getElementById("i3").value;
				 i4 = document.getElementById("i4").value;
				 i5 = document.getElementById("i5").value;
				 i7 = document.getElementById("i7").value;
				 i8 = document.getElementById("i8").value;
				 i9 = document.getElementById("i9").value;
				 i11 = document.getElementById("i11").value;
				 i15 = document.getElementById("i15").value;
				  if(i1 == '' || i1 == 0){
					  PigossMsg.alert("预期目标不能为空或者空格！");
					  return;
				  }
				  if(i9 == '' || i9 == 0){
					  PigossMsg.alert("客户环境调查不能为空或者空格！");
					  return;
				  }
				  if(i3 == '' || i3 == 0){
					  PigossMsg.alert("客户关注点不能为空或者空格！");
					  return;
				  }
				  if(i4 == '' || i4 == 0){
					  PigossMsg.alert("下一步计划不能为空或者空格！");
					  return;
				  }
				  if(i5 == '' || i5 == 0){
					  PigossMsg.alert("交流信息纪要不能为空或者空格！");
					  return;
				  }
				  if(i11 == '' || i11 == 0){
					  PigossMsg.alert("竞争对手动态不能为空或者空格！");
					  return;
				  }
				  	 
			}
			//对会议纪要
			if(serviceNo=="s6"){
				 i1 = document.getElementById("i1").value;
				 i4 = document.getElementById("i4").value;
				 i5 = document.getElementById("i5").value;
				 i6 = document.getElementById("i6").value;
				 i8 = document.getElementById("i8").value;
				  if(i1 == '' || i1 == 0){
					  PigossMsg.alert("预期目标不能为空或者空格！");
					  return;
				  }
				  if(i4 == '' || i4 == 0){
					  PigossMsg.alert("下一步计划不能为空或者空格！");
					  return;
				  }
				  if(i5 == '' || i5 == 0){
					  PigossMsg.alert("交流信息纪要不能为空或者空格！");
					  return;
				  }
				  	 
			}
			//对文档编写
			if(serviceNo=="s7"){
				 i8 = document.getElementById("i8").value;
				 i10 = document.getElementById("i10").value;
				 i14 = document.getElementById("i14").value;
				  if(i10 == '' || i10 == 0){
					  PigossMsg.alert("文档说明不能为空或者空格！");
					  return;
				  }
				  if(i14 == '' || i14 == 0){
					  PigossMsg.alert("对方接收人不能为空或者空格！");
					  return;
				  }
					 
			}
			//对客户拜访
			if(serviceNo=="s8"){
				 i1 = document.getElementById("i1").value;
				 i4 = document.getElementById("i4").value;
				 i5 = document.getElementById("i5").value;
				 i8 = document.getElementById("i8").value;
				  if(i1 == '' || i1 == 0){
					  PigossMsg.alert("预期目标不能为空或者空格！");
					  return;
				  }
				  if(i5 == '' || i5 == 0){
					  PigossMsg.alert("交流信息纪要不能为空或者空格！");
					  return;
				  }
			}
			AjaxUtil.request({
				url : 'add_project_sale.action',
				params : {insertClientContact:insertClientContact,insertLabor:insertLabor,supportDate:supportDate,hours:hours,address:address,otherPeople:otherPeople,serviceType:serviceType,ourPeoples:ourPeoples,serviceNo:serviceNo,
					id:id,i1:i1,i2:i2,i3:i3,i4:i4,i5:i5,i6:i6,i7:i7,i8:i8,i9:i9,i10:i10,i11:i11,i12:i12,i13:i13,i14:i14,i15:i15},
				success : function(responseText){
					RefreshhProject.refresh();
				},
				failure : function(){
					PigossMsg.alert("添加失败!");
				}
			});
			imgCloseShow();
		},
	//保存并上传文件--------------------------------------------------------------------------------------------------------------------
	saveSaleAndSaveDoc:function(){
		
	},
	//更新ProjectService
	updateProjectServices:function(){
		var psid = document.getElementById("editPSid").value;
		var supportDate = document.getElementById("editPSSupportDate").value;
		var hours = document.getElementById("editPSHours").value;
		var otherPeople = document.getElementById("editPSOtherPeople").value;
		var serviceType = document.getElementById("editPSServiceType").value;
		var address = document.getElementById("editPSAddress").value;
		
		var ourPeople = document.getElementsByName("editPSOurPeople");
		var ourPeoples='';    
		for(var i=0; i<ourPeople.length; i++){    
			if(ourPeople[i].checked){
				ourPeoples+=ourPeople[i].value+',';
			}
		} 
		
		var editServiceNo = document.getElementById("editServiceNo").value;
		
		if(hours == '' || hours == 0){
			PigossMsg.alert("小时数不能为空或者空格！");
			return;
		}
		if(otherPeople == '' || otherPeople == 0){
			PigossMsg.alert("他方人员不能为空或者空格！");
			return;
		}
		
		var i1 = "";
		var i2 = "";
		var i3 = "";
		var i4 = "";
		var i5 = "";
		var i6 = "";
		var i7 = "";
		var i8 = "";
		var i9 = "";
		var i10 = "";
		var i11 = "";
		var i12 = "";
		var i13 = "";
		var i14 = "";
		var i15 = "";
		
		
		//验证现场售后服务
		if(editServiceNo=="s1"){
			 i1 = document.getElementById("i1").value;
			 i2 = document.getElementById("i2").value;
			 i3 = document.getElementById("i3").value;
			 i4 = document.getElementById("i4").value;
			 i6 = document.getElementById("i6").value;
			 i7 = document.getElementById("i7").value;
			 i8 = document.getElementById("i8").value;
			 i13 = document.getElementById("i13").value;
			 
			  if(i1 == '' || i1 == 0){
				  PigossMsg.alert("预期目标不能为空或者空格！");
				  return;
			  }
			  
			  if(i2 == '' || i2 == 0){
				  PigossMsg.alert("工作内容记录不能为空或者空格！");
				  return;
			  }
			  if(i3 == '' || i3 == 0){
				  PigossMsg.alert("客户关注点不能为空或者空格！");
				  return;
			  }
			  if(i4 == '' || i4 == 0){
				  PigossMsg.alert("下一步计划不能为空或者空格！");
				  return;
			  }
			  if(i6 == '' || i6 == 0){
				  PigossMsg.alert("遗留问题不能为空或者空格！");
				  return;
			  }
			  	 
		}
		//对现场实施服务验证
		if(editServiceNo=="s2"){
			 i1 = document.getElementById("i1").value;
			 i2 = document.getElementById("i2").value;
			 i3 = document.getElementById("i3").value;
			 i4 = document.getElementById("i4").value;
			 i6 = document.getElementById("i6").value;
			 i7 = document.getElementById("i7").value;
			 i8 = document.getElementById("i8").value;
			 i13 = document.getElementById("i13").value;
			  if(i1 == '' || i1 == 0){
				  PigossMsg.alert("预期目标不能为空或者空格！");
				  return;
			  }
			  
			  if(i2 == '' || i2 == 0){
				  PigossMsg.alert("工作内容记录不能为空或者空格！");
				  return;
			  }
			  if(i3 == '' || i3 == 0){
				  PigossMsg.alert("客户关注点不能为空或者空格！");
				  return;
			  }
			  if(i4 == '' || i4 == 0){
				  PigossMsg.alert("下一步计划不能为空或者空格！");
				  return;
			  }
			  if(i6 == '' || i6 == 0){
				  PigossMsg.alert("遗留问题不能为空或者空格！");
				  return;
			  }
			  	 
		}
		//对现场售前测试(POC)进行验证
		if(editServiceNo=="s3"){
			 i1 = document.getElementById("i1").value;
			 i2 = document.getElementById("i2").value;
			 i3 = document.getElementById("i3").value;
			 i4 = document.getElementById("i4").value;
			 i6 = document.getElementById("i6").value;
			 i7 = document.getElementById("i7").value;
			 i8 = document.getElementById("i8").value;
			 i9 = document.getElementById("i9").value;
			 i11 = document.getElementById("i11").value;
			 i13 = document.getElementById("i13").value;
			 i15 = document.getElementById("i15").value;
			  if(i1 == '' || i1 == 0){
				  PigossMsg.alert("预期目标不能为空或者空格！");
				  return;
			  }
			  if(i2 == '' || i2 == 0){
				  PigossMsg.alert("工作内容记录不能为空或者空格！");
				  return;
			  }
			  if(i3 == '' || i3 == 0){
				  PigossMsg.alert("客户关注点不能为空或者空格！");
				  return;
			  }
			  if(i4 == '' || i4 == 0){
				  PigossMsg.alert("下一步计划不能为空或者空格！");
				  return;
			  }
			  if(i6 == '' || i6 == 0){
				  PigossMsg.alert("遗留问题不能为空或者空格！");
				  return;
			  }
			  	 
		}
		//对系统升级服务
		if(editServiceNo=="s4"){
			 i1 = document.getElementById("i1").value;
			 i2 = document.getElementById("i2").value;
			 i3 = document.getElementById("i3").value;
			 i4 = document.getElementById("i4").value;
			 i6 = document.getElementById("i6").value;
			 i7 = document.getElementById("i7").value;
			 i8 = document.getElementById("i8").value;
			 i12 = document.getElementById("i12").value;
			 i13 = document.getElementById("i13").value;
			  if(i1 == '' || i1 == 0){
				  PigossMsg.alert("预期目标不能为空或者空格！");
				  return;
			  }
			  if(i2 == '' || i2 == 0){
				  PigossMsg.alert("工作内容记录不能为空或者空格！");
				  return;
			  }
			  if(i3 == '' || i3 == 0){
				  PigossMsg.alert("客户关注点不能为空或者空格！");
				  return;
			  }
			  if(i4 == '' || i4 == 0){
				  PigossMsg.alert("下一步计划不能为空或者空格！");
				  return;
			  }
			  if(i6 == '' || i6 == 0){
				  PigossMsg.alert("遗留问题不能为空或者空格！");
				  return;
			  }
			  	 
		}
		//对售前交流验证
		if(editServiceNo=="s5"){
			 i1 = document.getElementById("i1").value;
			 i3 = document.getElementById("i3").value;
			 i4 = document.getElementById("i4").value;
			 i5 = document.getElementById("i5").value;
			 i7 = document.getElementById("i7").value;
			 i8 = document.getElementById("i8").value;
			 i9 = document.getElementById("i9").value;
			 i11 = document.getElementById("i11").value;
			 i15 = document.getElementById("i15").value;
			  if(i1 == '' || i1 == 0){
				  PigossMsg.alert("预期目标不能为空或者空格！");
				  return;
			  }
			  if(i9 == '' || i9 == 0){
				  PigossMsg.alert("客户环境调查不能为空或者空格！");
				  return;
			  }
			  if(i3 == '' || i3 == 0){
				  PigossMsg.alert("客户关注点不能为空或者空格！");
				  return;
			  }
			  if(i4 == '' || i4 == 0){
				  PigossMsg.alert("下一步计划不能为空或者空格！");
				  return;
			  }
			  if(i5 == '' || i5 == 0){
				  PigossMsg.alert("交流信息纪要不能为空或者空格！");
				  return;
			  }
			  if(i11 == '' || i11 == 0){
				  PigossMsg.alert("竞争对手动态不能为空或者空格！");
				  return;
			  }
			  	 
		}
		//对会议纪要
		if(editServiceNo=="s6"){
			 i1 = document.getElementById("i1").value;
			 i4 = document.getElementById("i4").value;
			 i5 = document.getElementById("i5").value;
			 i6 = document.getElementById("i6").value;
			 i8 = document.getElementById("i8").value;
			  if(i1 == '' || i1 == 0){
				  PigossMsg.alert("预期目标不能为空或者空格！");
				  return;
			  }
			  if(i4 == '' || i4 == 0){
				  PigossMsg.alert("下一步计划不能为空或者空格！");
				  return;
			  }
			  if(i5 == '' || i5 == 0){
				  PigossMsg.alert("交流信息纪要不能为空或者空格！");
				  return;
			  }
			  	 
		}
		//对文档编写
		if(editServiceNo=="s7"){
			 i8 = document.getElementById("i8").value;
			 i10 = document.getElementById("i10").value;
			 i14 = document.getElementById("i14").value;
			  if(i10 == '' || i10 == 0){
				  PigossMsg.alert("文档说明不能为空或者空格！");
				  return;
			  }
			  if(i14 == '' || i14 == 0){
				  PigossMsg.alert("对方接收人不能为空或者空格！");
				  return;
			  }
				 
		}
		//对客户拜访
		if(editServiceNo=="s8"){
			 i1 = document.getElementById("i1").value;
			 i4 = document.getElementById("i4").value;
			 i5 = document.getElementById("i5").value;
			 i8 = document.getElementById("i8").value;
			  if(i1 == '' || i1 == 0){
				  PigossMsg.alert("预期目标不能为空或者空格！");
				  return;
			  }
			  if(i5 == '' || i5 == 0){
				  PigossMsg.alert("交流信息纪要不能为空或者空格！");
				  return;
			  }
		}
		
		
		AjaxUtil.request({
			url : 'update_projectServices.action',
			params : {supportDate:supportDate,hours:hours,address:address,otherPeople:otherPeople,serviceType:serviceType,ourPeoples:ourPeoples,psid:psid,
				i1:i1,i2:i2,i3:i3,i4:i4,i5:i5,i6:i6,i7:i7,i8:i8,i9:i9,i10:i10,i11:i11,i12:i12,i13:i13,i14:i14,i15:i15},
			success : function(responseText){
				RefreshhProject.refresh();
			},
			failure : function(){
				PigossMsg.alert("添加失败!");
			}
		});
		imgCloseShow();
		
		
	}
};

//对项目下的技术备忘录表进行保存的操作
AddProjectTechNote = {
		saveTechNote:function (){
			var id = document.getElementById("pid").value;
			var reportDate = document.getElementById("addReportDate").value;
			var reporter = document.getElementById("addReporter").value;
			var briefDesc = document.getElementById("addBriefDesc").value;
			var detailDesc = document.getElementById("addDetailDesc").value;
			var type = document.getElementById("addType").value;
			var level = document.getElementById("addLevel").value;
			var doer = document.getElementById("addDoer").value;
			/*var state = document.getElementById("addState").value;
			var techDemon = document.getElementById("addTechDemon").value;
			var closetime = document.getElementById("addClosetime").value;
			
			reportDatex = reportDate.split("-");
			closetimex = closetime.split("-");
			var timeStart = new Date(reportDatex[0],reportDatex[1],reportDatex[2]);
			var timeEnd = new Date(closetimex[0],closetimex[1],closetimex[2]);
			if(timeStart > timeEnd){
				PigossMsg.alert("完成时间必须小于等于报告时间！");
				return;
			}*/
			
			if(type==0||type==''){
			   PigossMsg.alert("销售表类型不能为空或者空格！");
			   return;
			}
			if("售前客户拜访"==type ||"售前技术交流"==type||"售前文档编写"==type){
				if(focusContent==0||focusContent==''){
				   PigossMsg.alert("客户关注不能为空或者空格！");
				   return;
				}
				if(server==0||server==''){
				   PigossMsg.alert("提供服务人不能为空或者空格！");
				   return;
				}
				if(rivalMsg==0||rivalMsg==''){
				   PigossMsg.alert("竞争对手信息不能为空或者空格！");
				   return;
				}
			}
			if("售后客户拜访"==type ||"售后技术交流"==type||"售后客户服务"==type){
				if(leftProblem==0||leftProblem==''){
				   PigossMsg.alert("遗留问题不能为空或者空格！");
				   return;
				}
				if(nextStep==0||nextStep==''){
				   PigossMsg.alert("下一步计划不能为空或者空格！");
				   return;
				}
			}
			AjaxUtil.request({
				url : 'add_project_techNote.action',
				params : {id:id,reportDate:reportDate,reporter:reporter,briefDesc:briefDesc,detailDesc:detailDesc,type:type,level:level,
					doer:doer/*,state:state,techDemon:techDemon,closetime:closetime*/},
				success : function(responseText){
					RefreshProjectTechNote.refresh();
				},
				failure : function(){
					PigossMsg.alert("添加失败!");
				}
			});
			imgCloseShow();
		    
		},
		//更新技术备忘录
		update_techNote:function(tid){
			var reportDate = document.getElementById("editReportDate").value;
			var reporter = document.getElementById("editReporter").value;
			var briefDesc = document.getElementById("editBriefDesc").value;
			var detailDesc = document.getElementById("editDetailDesc").value;
			var type = document.getElementById("editType").value;
			var level = document.getElementById("editLevel").value;
			var doer = document.getElementById("editDoer").value;
			var state = document.getElementById("editState").value;
			var techDemon = document.getElementById("editTechDemon").value;
			var closetime = document.getElementById("editClosetime").value;
			
			reportDatex = reportDate.split("-");
			closetimex = closetime.split("-");
			var timeStart = new Date(reportDatex[0],reportDatex[1],reportDatex[2]);
			var timeEnd = new Date(closetimex[0],closetimex[1],closetimex[2]);
			if(timeStart > timeEnd){
				PigossMsg.alert("完成时间必须小于等于报告时间！");
				return;
			}
			
			AjaxUtil.request({
				url : 'update_techNote.action',
				params : {id:tid,reportDate:reportDate,reporter:reporter,briefDesc:briefDesc,detailDesc:detailDesc,type:type,
					level:level,doer:doer,state:state,techDemon:techDemon,closetime:closetime},
				success : function(responseText){
					RefreshProjectTechNote.refresh();
				},
				failure : function(){
					PigossMsg.alert("添加失败!");
				}
			});
			imgCloseShow();
		},
		del:function(tid){
			AjaxUtil.request({
				url : 'del_techNote.action',
				params : {id:tid},
				success : function(responseText){
					RefreshProjectTechNote.refresh();
				},
				failure : function(){
					PigossMsg.alert("添加失败!");
				}
			});
		}
};

RefreshProjectTechNote= {
	   refresh:function(){
	       document.getElementById("queryProjectTechNoteByCondition").submit();
	   }
};



//对项目下的联系人表进行保存的操作
AddProjectClient = {
		saveClient:function (){
			var id = document.getElementById("pid").value;
			var contactName = document.getElementById("contactName").value;
			var address = document.getElementById("address").value;
			var tel = document.getElementById("tel").value;
			var company = document.getElementById("company").value;
			var email = document.getElementById("email").value;
			
			if(contactName==0||contactName==''){
			   PigossMsg.alert("联系人成么不能为空或者空格！");
			   return;
			}
			if(address==0||address==''){
			   PigossMsg.alert("联系人地址不能为空或者空格！");
			   return;
			}
			if(company==0||company==''){
			   PigossMsg.alert("联系人公司不能为空或者空格！");
			   return;
			}
			
			if(tel==0||tel==''){
			   PigossMsg.alert("电话不能为空或者空格！");
			   return;
			}
			if(email==0||email==''){
			   PigossMsg.alert("下一步计划不能为空或者空格！");
			   return;
			}
			if(tel !=""){
				 var isExit = false;
				 var partten = /^0(([1-9]\d)|([3-9]\d{2}))\d{8}$/;
				 if (partten.test(tel)) {
					 //alert("是电话号码");
					 isExit = true;
				 }
				 if(/^13\d{9}$/g.test(tel)||(/^15[0-35-9]\d{8}$/g.test(tel))||(/^18[05-9]\d{8}$/g.test(tel))){
					 isExit = true;
				 }
				 if(!isExit){
					 PigossMsg.alert("联系电话不是电话或者手机号码！");
					 return;
				 }
			}
			if(email !=""){
				var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
				if (!(filter.test(email))){
					PigossMsg.alert("您的电子邮件格式不正确！");
					return;
				}
			} 
			AjaxUtil.request({
				url : 'add_project_client.action',
				params : {id:id,contactName:contactName,address:address,tel:tel,company:company,email:email},
				success : function(responseText){
					RefreshClientContact.refresh();
				},
				failure : function(){
					PigossMsg.alert("添加失败!");
				}
			});
			imgCloseShow();
		}
};

RefreshClientContact= {
		   refresh:function(){
		       document.getElementById("findAllClientContact").submit();
		   }
		};

EditClientContact={
		editContactClient:function(){
			var contactName = document.getElementById("editContactName").value;
			var id = document.getElementById("editCid").value;
			var address = document.getElementById("editAddress").value;
			var tel = document.getElementById("editTel").value;
			var company = document.getElementById("editCompany").value;
			var email = document.getElementById("editEmail").value;
			
			if(contactName==0||contactName==''){
				   PigossMsg.alert("联系人成么不能为空或者空格！");
				   return;
				}
				if(address==0||address==''){
				   PigossMsg.alert("联系人地址不能为空或者空格！");
				   return;
				}
				if(company==0||company==''){
				   PigossMsg.alert("联系人公司不能为空或者空格！");
				   return;
				}
				
				if(tel==0||tel==''){
				   PigossMsg.alert("电话不能为空或者空格！");
				   return;
				}
				if(email==0||email==''){
				   PigossMsg.alert("下一步计划不能为空或者空格！");
				   return;
				}
				if(tel !=""){
					 var isExit = false;
					 var partten = /^0(([1-9]\d)|([3-9]\d{2}))\d{8}$/;
					 if (partten.test(tel)) {
						 //alert("是电话号码");
						 isExit = true;
					 }
					 if(/^13\d{9}$/g.test(tel)||(/^15[0-35-9]\d{8}$/g.test(tel))||(/^18[05-9]\d{8}$/g.test(tel))){
						 isExit = true;
					 }
					 if(!isExit){
						 PigossMsg.alert("联系电话不是电话或者手机号码！");
						 return;
					 }
				}
				if(email !=""){
					var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
					if (!(filter.test(email))){
						PigossMsg.alert("您的电子邮件格式不正确！");
						return;
					}
				} 
				AjaxUtil.request({
					url : 'edit_project_client.action',
					params : {id:id,contactName:contactName,address:address,tel:tel,company:company,email:email},
					success : function(responseText){
						RefreshClientContact.refresh();
					},
					failure : function(){
						PigossMsg.alert("修改失败!");
					}
				});
				imgCloseShow();
		}
		
};

AddLog={
     saveConfig:function (){
       var ID=document.getElementById("ID").value;
       var describleLog=document.getElementById("describleLog").value;
       if(describleLog==0||describleLog==''){
		  PigossMsg.alert("日志内容不能为空或者空格!");
		  return;
		}
        AjaxUtil.request({
			url : 'log_add.action',
			params : {ID:ID,describleLog:describleLog},
			success : function(responseText){
				window.location.reload();
			},
			failure : function(){
				PigossMsg.alert("添加失败!");
			}
		});
		imgCloseShow();
        
     }
};
EditLog={
     editConfig:function (){
        var ID=document.getElementById("ID").value;
        var describleLog=document.getElementById("describleLog").value;
        
		AjaxUtil.request({
			url : 'log_edit.action',
			params : {ID:ID,describleLog:describleLog},
			success : function(responseText){
				window.location.reload();
			},
			failure : function(){
				PigossMsg.alert("添加失败！");
			}
		});
		imgCloseShow();
		
     },
     
     del:function (id){
	    AjaxUtil.request({
			url : 'log_delete.action',
			params : {id:id},
			success : function(responseText){
				window.location.reload();
			},
			failure : function(){
				PigossMsg.alert("删除失败!");
			}
		});
	}
};
